<?php
namespace App\Http\Models;

use Illuminate\Database\Eloquent\Model;

class WyqModel extends Model{

    protected $connection = 'db_main';
    protected $table = 'wp_wyq_test';
    protected $fillable = ["name", "sex", "create_time", "update_time", "grade", "class", "status"];
    public $timestamps = false;

    public static function getInfo($name){
        $map = [['name'=>'wyq']];
        $info = self::where($map)->first();

        return $info;
    }

    public static function addData($dataArr){
        $model = self::create($dataArr);

        return $model->id;
    }

    public static function delById($id){
        $map = ['id'=>$id];
        $flag = self::where($map)->delete();

        return $flag;
    }

    public static function saveData($map, $data){
        $flag = self::where($map)->update($data);
        return $flag;
    }

    public static function starttraction(){}
}